#pragma once

#include "d3d9.h"
#include "d3dx9.h"
#include "ModelManager.h"
#include "SpriteManager.h"
#include "Camera.h"
#include "DirectInput.h"
#include "MainMenu.h"
#include "Physics.h"
#include "UIBar.h"
#include "Sound.h"
#include "MiniGame.h"
#include "PowerUps.h"
#include "Lighting.h"
#include "TimerBar.h"
#include "VirusEnemy.h"
#include "Text.h"
#include "ObstacleManager.h"
#include "LevelManager.h"
#include "PowerBar.h"
//#include "Bullet.h"
#include "InGameMenu.h"
#include "HighScore.h"
#include "EndGame.h"
#include "Tutorial.h"

// Add pragma comments so we do not have to change
// the project dependencies
#pragma comment (lib, "d3d9.lib")
#pragma comment (lib, "d3dx9.lib")
#pragma comment (lib, "winmm.lib")	// Required for timeGetTime method

class Gameplay
{
private:
	///////////////////////////////////////////////
	// POINTERS
	DirectInput*		m_pDirectInput;
	bool				bKeyDown[256];
	ModelManager*		m_pModelManager;
	SpriteManager*		m_pSpriteManager;
	ObstacleManager*	m_pObstacleManager;
	Camera*				m_pCamera;
	MainMenu*			m_pMainMenu;
	Physics*			m_Physics;
	UIBar*				m_pUIBar;
	MiniGame*			m_pMiniGame;
	Sound*				m_pSound;
	PowerUps*			m_PowerUps;
	Lighting*			m_pLighting;
	TimerBar*			m_pTimerBar;
	VirusEnemy*			m_pVirusEnemy;
	Text*				m_pText;
	LevelManager*		m_pLevelManager;
	PowerBar*			m_pPowerBar;
	InGameMenu*			m_pInGameMenu;
	HighScore*			m_pHighScore;
	EndGame*			m_pEndGame;
	Tutorial*			m_pTutorial;
	///////////////////////////////////////////////

	// DirectX device
	IDirect3DDevice9*	m_pD3DDevice;
	// Camera booleans
	bool				bBuildMode;
	bool				bWorldCamera;
	// Variables to see if a track has been selected & placed
	bool				bTrackSelected;
	bool				bTrackPlaced;
	bool				bTrackPlaceable;
	bool				bTrackDeleted;
	D3DXVECTOR3*		vecRayPos;
	D3DXVECTOR3*		vecCircPos;
	// Varibale for holding a collision return with an object
	bool				bObstacleCollision;
	// Amount of models
	int					iModelCount;
	// ID number for minigame, from text file
	short				sMiniGameID;
	// Preloaded models
	short				sPreLoadedModels;
	short				sPrePowerUps;
	short				sPreVirus;
	short				sPreTeslaCoil;
	short				sPrePiston;
	short				sPreAcidPit;
	short				sPreFirewall;
	// Player's position
	D3DXVECTOR3			vecPlayerPos;
	// Game state
	short				sGameState;
	enum				eGameState{MAINMENU, INGAME, MINIGAME, ENDGAME};
	bool				bPaused;
	// Loading variables
	bool				bMusicLoaded;
	bool				bSoundLoaded;
	bool				bLevelLoaded;
	int					iCurrLevel;
	bool				bMiniGameLoaded;
	bool				bEndGameLoaded;
	// Score
	short				sScore;
	short				sCheckpointScore;
	// Booleans for "FIGHT MODE"
	bool				bFightMode;
	bool				bSwitchedMode;
	bool				bJumpOn;
	bool				bJumpComplete;
	bool				bFightDone;
	// Timer tracker
	int					iTimer;
	// Checkpoint tracker
	short				sCheckpoint;
	short				sPowerCheckpoint;
	short				sPowerUpsGathered;
	short				sTerminal;
	// Place holder for rayposition
	D3DXVECTOR3			vecLastPlacement;
	// Velocity variable
	float				fVelChange;
	// Mini game completion track ("SHIELD POWER")
	short				sMiniGameCount;
	// Holds camera changing in the y amount
	int					iYCamChange;

public:
	Gameplay(void);
	~Gameplay(void);

	void Init(IDirect3DDevice9* m_Device, HWND hWnd, HINSTANCE hInst, int nWidth, int nHeight);
	void Update(HWND hWnd, HINSTANCE hInst, float deltaTime);
	void Render(float deltaTime);
	void Reset(short sCheckpoint);
	void Reset();
	void Shutdown(void);
};
